<template>
  <div>
    <h1 class="title">新闻动态</h1>
    <div class="body">
      <div class="body_title">
        <span>新闻预览</span>
        <span class="preview" @click="goBack">返回上页</span>
      </div>
      <div class="main">
        <h5 class="title">{{news.title}}</h5>
        <div class="content" v-html="news.content"></div>
      </div>
    </div>
  </div>
</template>

<script>
  export default {
    name: "preview-news",
    data() {
      return {
        news: {}
      }
    },
    created() {
      let newsId = this.$route.params.id
      this.$post('/content/admin/news/query',{id: newsId},res=>{
        this.news = res
      })
    },
    methods: {
      goBack() {
        this.$router.go(-1)
      }
    }
  }
</script>

<style scoped>
  .title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 20px 0;
  }

  .body {
    border: 1px solid #EBEEF5;
  }

  .body .body_title {
    background-color: #EEEEEE;
    padding: 5px 10px;
  }

  .body_title .preview {
    float: right;
    font-size: 12px;
    line-height: 20px;
    cursor: pointer;
  }

  .body_title .preview:hover {
    color: #409EFF;
  }

  .body .main {
    padding: 20px;
    width: 800px;
    margin: 0 auto;
    overflow: hidden;
  }

  .body .main > .title {
    text-align: center;
  }

  .body .main .content img {
    max-width: 100%;
    margin: 0 auto;
    overflow: hidden;
  }
</style>
